home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 118 / cd-rom 118.iso / aplic / open / openofficeorg3.cab / master_usability_links.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-09-20  |  12.1 KB  |  256 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.    $RCSfile: master_usability_links.xsl,v $
  5.  
  6.    $Revision: 1.4 $
  7.  
  8.    last change: $Author: rt $ $Date: 2004/09/20 12:24:05 $
  9.  
  10.    The Contents of this file are made available subject to the terms of
  11.    either of the following licenses
  12.  
  13.           - GNU Lesser General Public License Version 2.1
  14.           - Sun Industry Standards Source License Version 1.1
  15.  
  16.    Sun Microsystems Inc., October, 2000
  17.  
  18.    GNU Lesser General Public License Version 2.1
  19.    =============================================
  20.    Copyright 2000 by Sun Microsystems, Inc.
  21.    901 San Antonio Road, Palo Alto, CA 94303, USA
  22.  
  23.    This library is free software; you can redistribute it and/or
  24.    modify it under the terms of the GNU Lesser General Public
  25.    License version 2.1, as published by the Free Software Foundation.
  26.  
  27.    This library is distributed in the hope that it will be useful,
  28.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  29.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  30.    Lesser General Public License for more details.
  31.  
  32.    You should have received a copy of the GNU Lesser General Public
  33.    License along with this library; if not, write to the Free Software
  34.    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  35.    MA  02111-1307  USA
  36.  
  37.  
  38.    Sun Industry Standards Source License Version 1.1
  39.    =================================================
  40.    The contents of this file are subject to the Sun Industry Standards
  41.    Source License Version 1.1 (the "License"); You may not use this file
  42.    except in compliance with the License. You may obtain a copy of the
  43.    License at http://www.openoffice.org/license.html.
  44.  
  45.    Software provided under this License is provided on an "AS IS" basis,
  46.    WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
  47.    WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
  48.    MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
  49.    See the License for the specific provisions governing your rights and
  50.    obligations concerning the Software.
  51.  
  52.    The Initial Developer of the Original Code is: Sun Microsystems, Inc.
  53.  
  54.    Copyright ┬⌐ 2002 by Sun Microsystems, Inc.
  55.  
  56.    All Rights Reserved.
  57.  
  58.    Contributor(s): _______________________________________
  59.  
  60. -->
  61. <!--
  62.     For further documentation and updates visit http://xml.openoffice.org/sx2ml
  63. -->
  64. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  65.         xmlns:office="http://openoffice.org/2000/office"
  66.         xmlns:style="http://openoffice.org/2000/style"
  67.         xmlns:text="http://openoffice.org/2000/text"
  68.         xmlns:table="http://openoffice.org/2000/table"
  69.         xmlns:draw="http://openoffice.org/2000/drawing"
  70.         xmlns:fo="http://www.w3.org/1999/XSL/Format"
  71.         xmlns:xlink="http://www.w3.org/1999/xlink"
  72.         xmlns:number="http://openoffice.org/2000/datastyle"
  73.         xmlns:svg="http://www.w3.org/2000/svg"
  74.         xmlns:chart="http://openoffice.org/2000/chart"
  75.         xmlns:dr3d="http://openoffice.org/2000/dr3d"
  76.         xmlns:math="http://www.w3.org/1998/Math/MathML"
  77.         xmlns:form="http://openoffice.org/2000/form"
  78.         xmlns:script="http://openoffice.org/2000/script"
  79.         xmlns:dc="http://purl.org/dc/elements/1.1/"
  80.         xmlns:meta="http://openoffice.org/2000/meta"
  81.         xmlns:config="http://openoffice.org/2001/config"
  82.         xmlns:help="http://openoffice.org/2000/help"
  83.         xmlns:sxg="http://www.jclark.com/xt/java/org.openoffice.xslt.OOoMasterDocument"
  84.         xmlns:java="http://xml.apache.org/xslt/java"
  85.         xmlns="http://www.w3.org/1999/xhtml"
  86.         version="1.0"
  87.         exclude-result-prefixes="office style text table draw fo xlink number svg chart dr3d math form script dc meta config help java sxg">
  88.  
  89.  
  90.     <!-- ******************************************************************************************************* -->
  91.     <!-- ***  Creation of a line of links at the beginning and end of a child document to enhance usability  *** -->
  92.     <!-- ******************************************************************************************************* -->
  93.  
  94.     <xsl:template name="add-child-document-usability-links">
  95.         <xsl:if test="$contentTableHeadings">
  96.         <p style="text-align:center;">
  97.             <xsl:element name="small">
  98.                 <xsl:text>[ </xsl:text>
  99.                 <xsl:variable name="currentChildNo" select="number($contentTableHeadings/heading[$currentChildContentRef = @file-url]/@child-document-no)" />
  100.                 <xsl:variable name="earlierDocURL" select="$contentTableHeadings/heading[($currentChildNo - 1) = @child-document-no]/@out-file-url" />
  101. <!--
  102. 2DO: add character entity CR - enable debugvariable -->
  103.                 <xsl:if test="$debugEnabled">
  104.                     <xsl:if test="$currentChildContentRef">
  105.                         <xsl:message>
  106.                             <xsl:text>
  107.  
  108. currentChildContentRef:
  109. </xsl:text>
  110.                             <xsl:value-of select="$currentChildContentRef" />
  111.                             <xsl:text>
  112.  
  113. </xsl:text>
  114.  
  115.                         </xsl:message>
  116.                     </xsl:if>
  117.                     <xsl:if test="$earlierDocURL">
  118.                         <xsl:message>
  119.                             <xsl:text>
  120.  
  121. earlierDoc:
  122. </xsl:text>
  123.                             <xsl:value-of select="$earlierDocURL" />
  124.                             <xsl:text>
  125.  
  126. </xsl:text>
  127.  
  128.                         </xsl:message>
  129.                     </xsl:if>
  130.                     <xsl:message>
  131.                         <xsl:text>
  132.  
  133. FinalRef:
  134. </xsl:text>
  135.                         <xsl:call-template name="get-relative-u-r-l-between-master-children">
  136.                             <xsl:with-param name="fromChildFileRef" select="$currentChildContentRef" />
  137.                             <xsl:with-param name="toChildFileRef" select="$earlierDocURL" />
  138.                         </xsl:call-template>
  139.                         <xsl:text>
  140.  
  141. </xsl:text>
  142.                     </xsl:message>
  143.                 </xsl:if>
  144.                 <xsl:if test="$earlierDocURL">
  145.                     <xsl:element name="a">
  146.                         <xsl:attribute name="href">
  147.                             <!-- when the links starts with a '#' it's a link to the Content Table-->
  148.                             <xsl:choose>
  149.                                 <xsl:when test="starts-with($earlierDocURL, '#')">
  150.                                     <xsl:call-template name="get-relative-u-r-l-between-master-children">
  151.                                         <xsl:with-param name="fromChildFileRef" select="$currentChildContentRef" />
  152.                                         <xsl:with-param name="toChildFileRef" select="." />
  153.                                     </xsl:call-template>
  154.  
  155.                                 </xsl:when>
  156.                                 <xsl:otherwise>
  157.                                     <xsl:call-template name="get-relative-u-r-l-between-master-children">
  158.                                         <xsl:with-param name="fromChildFileRef" select="$currentChildContentRef" />
  159.                                         <xsl:with-param name="toChildFileRef" select="$earlierDocURL" />
  160.                                     </xsl:call-template>
  161.                                 </xsl:otherwise>
  162.                             </xsl:choose>
  163.                         </xsl:attribute>
  164.                         <xsl:attribute name="title">Link to previous document</xsl:attribute>
  165.                         <xsl:text>Previous document</xsl:text>
  166.                     </xsl:element>
  167.  
  168.                     <xsl:text> | </xsl:text>
  169.                 </xsl:if>
  170.                 <xsl:element name="a">
  171.                     <xsl:attribute name="href">
  172.                         <!-- when currentChildContentRef is unset the current file is the Content Table-->
  173.                         <xsl:choose>
  174.                             <xsl:when test="$currentChildContentRef">
  175.                                 <xsl:call-template name="get-relative-content-table-u-r-l">
  176.                                     <xsl:with-param name="fromChildFileRef" select="$currentChildContentRef" />
  177.                                 </xsl:call-template>
  178.                             </xsl:when>
  179.                             <xsl:otherwise>
  180.                                 <xsl:text>#</xsl:text>
  181.                             </xsl:otherwise>
  182.                         </xsl:choose>
  183.                     </xsl:attribute>
  184.                     <xsl:attribute name="title">Link to the Content Table</xsl:attribute>
  185.                     <xsl:text>Content Table</xsl:text>
  186.                 </xsl:element>
  187.  
  188.  
  189.                 <xsl:variable name="nextDocURL" select="$contentTableHeadings/heading[($currentChildNo + 1) = @child-document-no]/@out-file-url" />
  190.                 <xsl:if test="$nextDocURL">
  191.                     <xsl:text> | </xsl:text>
  192.                     <xsl:element name="a">
  193.                         <xsl:attribute name="href">
  194.                             <!-- when the links starts with a '#' it's a link to the Content Table-->
  195.                             <xsl:choose>
  196.                                 <xsl:when test="starts-with($nextDocURL, '#')">
  197.                                     <xsl:call-template name="get-relative-u-r-l-between-master-children">
  198.                                         <xsl:with-param name="fromChildFileRef" select="$currentChildContentRef" />
  199.                                         <xsl:with-param name="toChildFileRef" select="." />
  200.                                     </xsl:call-template>
  201.                                 </xsl:when>
  202.                                 <xsl:otherwise>
  203.                                     <xsl:call-template name="get-relative-u-r-l-between-master-children">
  204.                                         <xsl:with-param name="fromChildFileRef" select="$currentChildContentRef" />
  205.                                         <xsl:with-param name="toChildFileRef" select="$nextDocURL" />
  206.                                     </xsl:call-template>
  207.                                 </xsl:otherwise>
  208.                             </xsl:choose>
  209.                         </xsl:attribute>
  210.                         <xsl:attribute name="title">Link to next document</xsl:attribute>
  211.                         <xsl:text>Next document</xsl:text>
  212.                     </xsl:element>
  213.                 </xsl:if>
  214.                 <xsl:text> ]</xsl:text>
  215.             </xsl:element>
  216.         </p>
  217.         </xsl:if>
  218.     </xsl:template>
  219.  
  220.  
  221.     <xsl:template name="get-relative-u-r-l-between-master-children">
  222.         <xsl:param name="fromChildFileRef" />
  223.         <xsl:param name="toChildFileRef" />
  224.  
  225.         <xsl:choose>
  226.             <xsl:when test="function-available('sxg:get-relative-u-r-l-between-master-children')">
  227.                 <xsl:value-of select="sxg:get-relative-u-r-l-between-master-children(string($fromChildFileRef), string($toChildFileRef))" />
  228.             </xsl:when>
  229.             <xsl:when test="function-available('java:org.openoffice.xslt.OOoMasterDocument.getRelativeURLBetweenMasterChildren')">
  230.                 <xsl:value-of select="java:org.openoffice.xslt.OOoMasterDocument.getRelativeURLBetweenMasterChildren(string($fromChildFileRef), string($toChildFileRef))" />
  231.             </xsl:when>
  232.             <xsl:otherwise>
  233.                 <xsl:message terminate="yes">ERROR: Function not found: java:org.openoffice.xslt.OOoMasterDocument.getRelativeURLBetweenMasterChildren</xsl:message>
  234.             </xsl:otherwise>
  235.         </xsl:choose>
  236.     </xsl:template>
  237.  
  238.  
  239.     <xsl:template name="get-relative-content-table-u-r-l">
  240.         <xsl:param name="fromChildFileRef" />
  241.  
  242.         <xsl:choose>
  243.             <xsl:when test="function-available('sxg:get-relative-content-table-u-r-l')">
  244.                 <xsl:value-of select="sxg:get-relative-content-table-u-r-l(string($fromChildFileRef))" />
  245.             </xsl:when>
  246.             <xsl:when test="function-available('java:org.openoffice.xslt.OOoMasterDocument.getRelativeContentTableURL')">
  247.                 <xsl:value-of select="java:org.openoffice.xslt.OOoMasterDocument.getRelativeContentTableURL(string($fromChildFileRef))" />
  248.             </xsl:when>
  249.             <xsl:otherwise>
  250.                 <xsl:message terminate="yes">ERROR: Function not found: java:org.openoffice.xslt.OOoMasterDocument.getRelativeContentTableURL</xsl:message>
  251.             </xsl:otherwise>
  252.         </xsl:choose>
  253.     </xsl:template>
  254.  
  255. </xsl:stylesheet>
  256.